<?php

	session_start();
	if(!$_SESSION["username"]){
		//not logged in
		header("location:login.php");
	}
	
	// deletes file and returns to page
	if (isset($_GET['file'])){
	
		$filename=$_GET['file'];
		unlink("./temp/".$filename);
		
		switch($_GET['referrer']){
			case 'students':
				header("location:managestudents.php?message=success");
				break;
			case 'tutors':
				header("location:managetutors.php?message=success");
				break;
			case 'classes':
				header("location:manageclasses.php?message=success");
				break;
			default:
				header("location:index.php");
		}
		
	}
	
?>